package Managment;

import java.util.ArrayList;
import java.util.List;
import NegocioVO.AreaVO;
import bean.AreaBean;

public class ManagmentArea {
	

	private static ManagmentArea instancia;
	
	public static ManagmentArea getInstancia(){
		if(instancia == null)
			instancia = new ManagmentArea();
		return instancia;
	}

	public List<AreaVO> ListHibernateAVo(List<AreaBean> areas) {
		List<AreaVO> areasVO = new ArrayList<AreaVO>();
		for(int i = 0; areas.size() - 1 >= i; i++){
			AreaVO areaVO = new AreaVO();
			areaVO.setIdArea(areas.get(i).getIdArea());
			areaVO.setEmpleados(ManagmentEmpleado.getInstancia().ListHibernateAVo(areas.get(i).getEmpleados()));
		}
		return areasVO;
	}

	public AreaVO HibernateAVo(AreaBean areabean) {

		AreaVO areaVO = new AreaVO();
		areaVO.setIdArea(areabean.getIdArea());
		areaVO.setEmpleados(ManagmentEmpleado.getInstancia().ListHibernateAVo(areabean.getEmpleados()));
		return areaVO;
	}

	public AreaBean VoAHibernate(AreaVO area) {
		AreaBean areaBe = new AreaBean();
		areaBe.setIdArea(area.getIdArea());
		areaBe.setEmpleados(ManagmentEmpleado.getInstancia().ListVoAHibernate(area.getEmpleados()));
		return areaBe;
	}
}
